﻿using Microsoft.EntityFrameworkCore;
using System.Reflection.Metadata;

namespace WcMatch.Models
{
    public partial class DistrictContext : DbContext
    {
        public DistrictContext()
        {

        }

        public DistrictContext(DbContextOptions<DistrictContext> options) : base(options) { }

        public virtual DbSet<District>? Districts { get; set; } = null;

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {

        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.UseCollation("utf8_general_ci").HasCharSet("utf8");

            //public int Id { get; set; }
            //public string UserName { get; set; } = null!;
            //public string PassWord { get; set; } = null!;
            //public string DepartmentName { get; set; } = null!;


            modelBuilder.Entity<District>(entity =>
            {
                entity.ToTable("T_China");
                entity.Property(e => e.Id)
                    .HasMaxLength(20)
                    .HasColumnName("Id");
                entity.Property(e => e.Name)
                   .HasMaxLength(20)
                   .HasColumnName("Name");
                entity.Property(e => e.PId)
                   .HasMaxLength(20)
                   .HasColumnName("PId");
            });

            OnModelCreatingPartial(modelBuilder);
        }

        partial void OnModelCreatingPartial(ModelBuilder modelBuilder);

    }
}
